<template>
  <div class="home">
    <top-view></top-view>
    <sales-view></sales-view>
    <bottom-view></bottom-view>
    <map-view></map-view>
  </div>
</template>

<script>
import TopView from '@/components/TopView'
import SalesView from '@/components/SalesView'
import MapView from '@/components/MapView'
import BottomView from '@/components/BottomView'
import { wordCloud, screenData, mapScatter } from '@/api'
export default {
  name: 'Home',
  components: {
    TopView,
    SalesView,
    MapView,
    BottomView
  },
  data () {
    return {
      reportData: null,
      wordCloud: null,
      mapData: null
    }
  },
  methods: {
    getReportData () {
      return this.reportData
    },
    getWordCloud () {
      return this.wordCloud
    },
    getMapData () {
      return this.mapData
    }
  },
  provide () {
    return {
      getReportData: this.getReportData,
      getWordCloud: this.getWordCloud,
      getMapData: this.getMapData
    }
  },
  mounted () {
    wordCloud().then(res => {
      this.wordCloud = res
    })
    screenData().then(res => {
      this.reportData = res
    })
    mapScatter().then(res => {
      this.mapData = res
    })
  }
}
</script>

<style scoped>
  .home {
    width: 100%;
    margin: 0;
    padding: 20px;
    background: #eee;
    box-sizing: border-box;
  }
</style>
